I played it just last year. xD (and completed it so thoroughly that I beat every additional boss and got every master materia the hard way, in addition to the ones offered as rewards )
Basically, you can level up your materia by having it equipped in battles. Once you get one of every materia of a color up to its max level you get the master materia for that color.
(yes, I know you probably don't care, but there it is anyway )