This phrase compares the level of something to a standard that was previously mentioned or understood.
In the example above, the speaker just came out of the bathroom. So when he says, "such a disgusting bathroom," it's clear that he's comparing all the other bathrooms he's been in to the one that he just saw.
If he said this two hours after coming out of the bathroom, and no one had mentioned it in the conversation, this sentence wouldn't make sense.
Here's another example. You're talking about the car that you bought, which was too expensive:
I'm not sure why we bought such an expensive car.