There are a couple of ways that can be used to detect when the utility power is lost to a system that also includes sync'd generators.
Immediately before the power is lost, the system is in equilibrium - the power being used by the site is exactly equalled by the power being generated & the power being imported from the grid. At the moment the grid is lost, the equilibrium is upset. Its very unlikely that the generator is producing EXACTLY the amount of power that the site needs, so, at the point the utility fails, the generator will be producing either too much power or too little. If its producing too much power, it will ted to speed up, if too little it will slow down. This change in speed results in change in frequency. The rate of change of this frequency can be picked up by a ROCOF relay and used to open the utility breaker & also transfer the generator out of sync'd mode and into standalone mode.
A directional current relay could be used but only if the generator can NEVER export to the utility under normal conditions.