In the LN, there are 7 primordial demons that were the first demons. These 7 were the progenitors of all other demons and ruled over them. They also stand at the pinnacle of strength among demons.
The first one, Rouge/Red, broke through his race shackles and awoke as the demon lord Guy Crimson. He then summoned Vert (green) and Bleu (blue duh) to serve as his retainers.
Blanc (White), Jaune (yellow), Violet (purple) kept sabotaging each other's attempts to break through the race shackles so they were essentially stuck in a 3 way deadlock until they got shanghaied to Tempest by Diablo.
Noire (Black/Diablo) wasn't interested in power and instead spent his time dicking around.
As for the three specifically: Due to how rapidly Tempest was growing, there was a lot of open positions + a lot of work available. In order to find subordinates to foist work on so that he could stay by Rimuru 24/7 help make Tempest a better country, Diablo decided to "recruit" the three and their subordinates. Testarossa became Tempest's chief ambassador to the council of the Western Nations, Carrera was appointed head judge of the court of justice in Tempest, and Ultima took the role of the leader of the Tempest police force.