Your definition is a general one, not the one used in linguistics, but I presume the latter is the one you are questioning. It works in your 3rd example sentence, certainly; the other two obviously refer to the formal rather than the informal– but it is a matter of context, as is the case with many definitions of words. From an on-line linguistic glossary: Formality is a kind of social deixis that expresses the setting or social activity in which language use takes place.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
Mister Micawberbut I presume the latter is the one you are questioning