Mestre Bimba was the first to introduce a ranking system in capoeira; he used colored scarfs in his academy to determine the level of the student. Only years later, the mestres of the capoeira group Senzala came up with the idea to use belts, a system derived from other martial arts like judo and karate. Senzala developed a whole new ranking system on which many of the groups today still base their rankings.
You can read more about the ranking system in Mundo Capoeira here.
Because of the fact that capoeira doesn't have one managing organization which controls everything, every group can make its own choices and rules. Every capoeira group has the ability to create its own ranking system, which is a fact today. The number of ranks as well as the used colors and titles can differ a lot between groups.
Once per year capoeiristas get the chance to receive a new rank, depending on their level. Every group organizes a yearly event where new students are baptized and receive their first belt and other students might trade their belt for a higher one. This event is called the batizado, which means 'baptism' in Portuguese. The new student will have to play against a teacher in the roda. The teacher will drop the student (calmly) on the floor as a means of baptizing him. Capoeiristas who have been baptized before will not participate in the actual batizado but a separate ceremony, the troca de cordas or 'change of belts' is held for them.