The word before in the sentence is being used as a preposition. It is because preposition is being used to set as a link with the phrases, pronouns or nouns that is given in a sentence. It is used in making sentence clear and understandable for the reader and they are usually used in following nouns which is described in the sentence above.