Standing for a Torah scholar:
It is a positive command in the Torah to stand up in front of all Sages.
The age: The command to stand before a Sage applies even if the Sage is not old but is young [even if he is a child under Bar Mitzvah] and wise.
The amount of wisdom that defines a Sage: The command to stand before a Sage applies even if the Sage is not one’s teacher. It applies to any Sage who is greater than oneself [in Torah knowledge] and is fit to learn from him. This however only applies to a Sage whose knowledge is excelled far beyond the normal common folk, in which case if the person has more knowledge than oneself, then he is to stand for him. If however the person’s knowledge is not excelled far beyond the normal folk, then there is no obligation to stand for him even though he is more knowledgeable than oneself. Practically however, today the custom has become to only stand on behalf of the Rosh Yeshiva or Ravad, although the validity of this custom requires further clarification.
 Shach 244/1; Perisha; Darkei Moshe; Beis Yosef, all in name of Shivlei Haleket
 Michaber ibid
 Rama ibid; Tur in name of Rambam [or Rameh [see Shach 244/2; See however Beis Yosef and Beir Hagoleh] and Ran
 Shach 244/2; Tosafus; Semak 32; Rosh; Rameh
Other opinions: Some Poskim rule one is only required to stand for a Sage that is excelled far beyond even the Sages of his generation, even if he is more knowledgeable than oneself. [Rif, brought in Shach ibid]
 Shach 244/11
The reason: Seemingly the reason for this is in order not to differentiate between Sages [and hence avoid offending those people who one thinks is not a Sage], however the Rosh yeshiva or Raavad is a recognizable and undisputable Sage to whom all are to stand for. [Shach ibid]