Abu Mas'ud Al-Ansari (RadiyAllahu anhu) reported: Messenger of Allah (Sallellahu Alaihi Wa Sallam) would place his hands upon our shoulders when we would form rows for As-Salat (the prayer) and say, "Stand in straight rows and do not differ among yourselves, or else your hearts will differ due to disaccord. Let those be nearest to me who are mature and endowed with understanding (of the religion), then those who are nearest to them in these respects and then those who are nearest to them".
'Abdullah bin Mas'ud (RadiyAllahu anhu) reported: Messenger of Allah (Sallellahu Alaihi Wa Sallam) said, "Let those be nearest to me in Salat (prayer) who are mature and possess (religious) knowledge, then those who are nearest to them in these respects". He repeated this three times and then added, "Beware of indulging in the loose talks of the markets (when you are in the mosque)".
The meaning of the last sentence of this Hadith seems to be that one should not quarrel, make noise or engage in loose talk in or near a mosque to disturb the people in the mosque because such activities are severely condemned by Islam.