Functions- there are many: obligation, necessity. Functional teaching groups words and phrases into categories of what they do, not their grammar.
Appropriacy- simply ask whether the language fits the context. That'll tell you it's appropriacy. Formal/semi-formal/informal are broad groups, but that doesn't necessarily mean that anything can be rigidly labelled this way.
Despite + *gerund* - the concept hiding behind it is to show a contrast, but its function could be to show the speaker's surprise.