According to J.K. Rowling on Pottermore...
The magic used in the map's creation is advanced and impressive; it includes the Homonculous Charm, enabling the possessor of the map to track the movements of every person in the castle, and it was also enchanted to forever repel (as insultingly as possible) the curiosity of their nemesis, Severus Snape.
So apparently it was specifically designed to detect Snape, not simply anyone. (There's actually a whole article about that charm on the HP Wikia.) Thus, the personal nature of the insults (i.e. "abnormally large nose" and such) were clearly pre-programmed by the Marauders.
As for knowing he was a professor, many magical objects in the HP universe display awareness or semi-awareness, such as paintings that can hold conversations or cars that can become loyal or resentful. Apparently the map was aware enough to recognize who was reading it, and discern certain things about them.
Maybe it was listening when Harry mentioned "Professor Snape" at some point, or maybe it "just knows" through some abstract discernment spell, I doubt we'll ever know specifically.