Let us consider a language different anaphora depending on whether the NP it refers to is definite/specific or indefinite.The definite anaphora are the baseline - the pronoun for the masculine definite noun we call the masculine pronoun, the pronoun for the feminine definite noun we call the feminine pronoun, etc.
Now, we have a hierarchy of genders and numbers:
plur anim > masc sg > fem sg > neut
plur inanim > neut
For each indefinite noun, an anaphora referring to it will use the noun from the class to the right, so
If any people arrive, he(=they) must wait here.
Iif any man arrives, she(=he) may wait here.
If my boss arrives, he(=he) must wait here.