Grid sync requires that the voltage your inverter produces matches the grid voltage so the best way of achieving this is to compare, via a transformer, the two voltages. If perfectly matched, the transformer output will be zero and measurement errors are minimized.
simulate this circuit – Schematic created using CircuitLab
If there are harmonics present on one power signal relative to the other, the output voltage of the transformer will show these but at a reduced amplitude due to the increased eddy current losses as frequency rises. However, if the harmonics are identical on both, the harmonics will become zero when matched.