Here's my idea how to solve this:
Have two counters. Let both counters count to 127b (just an example). Those two counters have to start (reset) at the very same moment. One counter uses the predetermined frequency as input, and the other one uses the other frequency as input.
When at least one counter reach 127b, stop counting and check wheter both counters contains 127b. If the numbers fiffers, the frequency is also different.
And of course - the more pulses you counts, the more accurate the check will be. If it will work in practice is another story. You must consider when the frequency is equal, but different phase. Then one counter will always be one step behind.