How do you tell a *spelling mistake* from a *grammar mistake*? For example:

1. Your the best.
2. This iz the end.
3. I likes music.
4. She preatend to be asleep.

My guess is that 1 and 2 have spelling mistakes, and 3 and 4 have grammar mistakes. My method is to listen to pronunciation: if the sentence *sounds* correct then it has a spelling mistake, otherwise it has a grammar mistake. Is this method always valid?