A lot of people seem to want to know everything they can about the people around them. Not everyone is good at obtaining that information. Some use rather crude methods. While it is a rather different type of situation, I don't know how many times one guy I know has asked me what it was I'm eating. What the hell does it matter what I'm eating? Is that just so he can decide whether or not he wants to ask for some? Getting myself back on track...
Others want to find something that they think you are sensitive about. Not outright bullying, more light harassment. Give someone a hard time, feel like you have power over them, feel better about yourself. At least I think that's the logic behind it.
If it is a friend, they might consider it harmless. Telling them to lay off may help, may not. If it isn't a friend, well, like Vegasadelphia said, try to find a way to flip it on him. Try to find a way to make his words into his vulnerability. Bringing up other issues won't likely work, unless, well, you have serious dirt on the person. Then the issue of ethics / morality comes up. Is it the "right" thing to use their same methods? Using what they say, on the other hand, is only using what they give you in the moment.