What principally distinguishes a mahram legally?

Kitāb al-Ḥajj: Obligation and Conditions of Pilgrimage