We report high resolution x-ray diffraction measurements of (Ga,Mn)As and (Ga,Mn)(As,P) epilayers. We observe a structural anisotropy in the form of stacking faults which are present in the (111) and (11-1) planes and absent in the (-111) and (1-11) planes. The stacking faults produce no macroscopic strain. They occupy 0.01 - 0.1 per cent of the epilayer volume. Full-potential density functional calculations evidence an attraction of Mn_Ga impurities to the stacking faults. We argue that the enhanced Mn density along the common [1-10] direction of the stacking fault planes produces sufficiently strong [110]/[1-10] symmetry breaking mechanism to account for the in-plane uniaxial magnetocrystalline anisotropy of these ferromagnetic semiconductors.