I wonder basically what you understand as comparison of AC voltage momentary values respectivly how you define the operation? If you have a meaningful definition, then you'll also find a suitable circuit to my opinion.
Normal way, as used e. g. in generator synchronisation would be to extract phase and voltage as independant parameters and have two individual controllers performing the synchronisation. Phase/frequency measurement would achieve both frequency synchronisation and phase lock. Phase/frequency information can be extracted as simple sign function with a comparator and processed by timer and/or input capture. Voltage in contrast must be acquired as an analog signal to allow effective control action.
Another option for low frequency (I would regard mains frequency as such) is to extract phase and amplitude by digital signal processing. This would need a sufficient number of samples for both input voltages, e. g. 4 per cycle, resulting in 480 SPS minimum. Of course, the difference in sampling time of both signals must be considered. I don't know, if the intended µP would be cacapable of this kind of signal processing.