The things that are never touched
Quoted strings, quoted identifiers and comments are tokenised before anything else looks at them, and every one of them is copied verbatim. An identifier written `"SELECT"` is a column name, not a keyword, so it is never recased. A string literal such as `'WHERE x = 1'` is data, not a clause. The consequence is that a query with unusual spelling keeps exactly that spelling in the parts that mean it literally.
The recognized keyword list is fixed and modest - the clauses, the join words, the operators (AND, OR, IN, LIKE, IS NULL and similar). Anything outside that list is copied character for character: a dialect extension, a custom operator, a column that happens to look like a word.