It's either you don't here something that somebody said correctly and you want them to repeat it or if you yell (or put in capital letters if you're are writing it) the "what" it means that the other person just told you something that you don't like or unpleasantly surprised you.
1)
Friend: I can't wait for the fair tomorrow!
You: (busy preparing for the fair) I'm sorry, what?
2)
Boyfriend/girlfriend: I'm braking up with you.
You: I'm sorry, WHAT!!!!!!!!
Notice the difference????