The influence of arrangement and content of substituents (B, In) in BGaAs, InGaAs, and BInGaAs alloys on the stabilities and band gaps is investigated using density-functional supercell calculations. The stability of ternary alloys decreases from InGaAs over BGaAs to GaAsN. Typical substituent structures show the following stability order: isolated substituents -[110] chains -clusters -twisted [111] chains -(200/211) arrangements (most stable). This is valid for both the In-and B-poor as well as the In-and B-rich alloys. From the fact that grown InGaAs provides a different gap than the most stable arrangement one can conclude that other structures (isolated indium atoms or In m As clusters) are formed during the growth. Simultaneous substitutions (BInGaAs) of larger (In) and smaller (B) atoms prefer arrangements in larger distances (220) for isovalent boron substitution and in In -B bonds for antisite boron substitution. The high degree boron antisite substitution induces partially occupied acceptor bands which lead to a strong reduction of the band gap in comparison to the isovalent substitution.