ṛg-atharva-yajuḥ-sāmnāṁ
rāśīr uddhṛtya vargaśaḥ
catasraḥ saṁhitāś cakre
mantrair maṇi-gaṇā iva
ṛk-atharva-yajuḥ-sāmnām - of the Ṛg, Atharva, Yajur and Sāma Vedas; rāśīḥ - the accumulation (of mantras); uddhṛtya - separating out; vargaśaḥ - in specific categories; catasraḥ - four; saṁhitāḥ - collections; cakre - he made; mantraiḥ - with the mantras; maṇi-gaṇāḥ - gems; iva - just as.
When Lord Brahmā first spoke the four Vedas with his four mouths, the mantras were mixed together like an unsorted collection of various types of jewels. Śrīla Vyāsadeva sorted the Vedic mantras into four divisions (saṁhitās), which thus became the recognizable Ṛg, Atharva, Yajur and Sāma Vedas.