(I happened to find this answer yesterday.)
The source for this halachah is the mishnah, Brachos 2:1.The language of the mishnah is this (omitting the opinion of Rabbi Meir which is not accepted by halachah):
Rabbi Yehudah says: In the middle, he greets out
of fear and returns out of honor; and [between] the chapters, he
greets out of honor and returns greeting to every man.
The Tiferes Yisrael asks (Yachin 7; the question of the Tosafos Yom Tov): Why in the beginning does it say that "he returns" but in the end it says "he returns greeting"?
He answers that it comes to teach you that in the case of honor and fear, even if he greets or returns with other matters — for example, he sees an honored person searching for something and he asks him what he is looking for, or if he asks him what he told him to do — it is also permissible. This is because it said only that he "returns," but it doesn't specify what he can return. However, concerning ordinary people, it only says you can "return greeting," meaning that it is only greeting which it is permissible to return, but not other matters.
According to this, you are allowed to respond in other matters to a person out of honor or fear. However, to an ordinary person, you only are allowed to return greeting.
However, what is interesting is that the halachah that you are allowed to greet or respond to someone is brought in Orach Chaim 66:1, and there it doesn't use the language that the mishnah used. I don't think the mechaber meant to change that halachah, though.