Unlike DC generator, synchronous generator, which is the commonly used type of generator for power plants around the world, need to have the same frequency and in-phase to the grid frequency before connecting. This is also the reason why the act of interconnecting a synchronous generator to the Transmission Grid is synchronization.
If the generator output voltage frequency (usually 60 Hz and 50 Hz) is not the same and not in-phase with the Grid voltage frequency, there is a voltage difference between the two. Thus, interconnecting the two NOT in-phase voltage could be disastrous (a short circuit).
Since it is not possible to visually see the voltage frequency of both generator and the grid, a method called dark-lamp method could be used. In dark-lamp method, a lamp or bulb or anything the emit light is connected between the source of two frequencies. If the two frequencies, grid and generator, are the same and in-phase, there is no voltage difference and thus, the lamp will not emit light. That’s the only time that the generator can be connected to the Transmission Grid. A synchronoscope is also added in the synchronization set-up to help the plant operator in controlling the rotational speed of the generator.
Of course, dark lamp method is an old technology.
The following video is an actual synchronization of a hydro power generation unit to the grid.