Can languages be compared mathematically?

I watched all 20 episodes of Hamish MacBeth a few times and was able to follow almost all of the dialog. After that, Trainspotting was a walk in the park.