No. Officially, the PS3 cannot play PS2 games unless they are specially done up for the PS3 and offered for purchase; or you have an older PS3.
In reality, the PSN Classics work off of a software emulator that has been found by the homebrew community to work (with varying accuracy/playability) with quite a few more games than are actually offered on the PS Store, similar to the one that the 360 uses for original Xbox games.
As far as the PS4 goes, Sony have neither confirmed or denied that it will not have actual PSX and PS2 compatibility; but they have hinted that it will all be done through Gakai instead as PS3 games will.