A computer with identical specs to a PS4/Xbox won't play the same games exactly the same. Just like how a fancy new Mac with inferior hardware runs really smooth(just don't try gaming on it).
The console is running a custom OS meant specifically for playing games created for it. Whereas on a PC, there's the matter of having to use Windows, making sure drivers are installed correctly/up-to-date & what processes are open/running in the background that could potentially affect game play.