In this usage, "before" functions as a conjunction, and a comma is necessary to separate the clauses or phrases and ensure proper grammatical structure.
For instance:
>*Before they left, the children said goodbye to their grandparents.*
>*He asked for a day off, before the important meeting.*
>*Before making a decision, consider all your options carefully.*
In these sentences, "before" introduces an independent clause, and the comma helps distinguish the main clause from the subordinate clause.
However, you don't need a comma if "before" is being used as a preposition or part of a prepositional phrase. In such cases, it does not introduce a separate independent clause.
For example:
>*She arrived at the party before nine o'clock.*
>*The sun sets before eight o'clock in winter.*
>*They had a meeting before lunch.*
In these examples, "before" is used as a preposition or in conjunction with a preposition (before nine, before eight), and a comma is unnecessary.