It's called title case, and it's not determined by the length of a word but by whether or not a word is minor. The rules defining minor words vary slightly between styles, but they're usually prepositions and articles.
> Lowercase only minor words that are three letters or fewer in a title or heading (except the first word in a title or subtitle or the first word after a colon, em dash, or end punctuation in a heading)