Using energy dispersive X-ray (EDX) spectroscopy coupled to transmission electron microscopy (TEM), we have identified the anisotropy mechanism allowing for the smooth and vertical etching of InP-based heterostructures of interest in the fabrication of photonic devices. We show that the anisotropic profiles reported with Cl2/H2- or HBr-containing gas mixtures are due to the formation of a thin silicon oxide passivation layer resulting from the reaction of Cl2 or HBr with the silicon wafer used as the sample tray. The experimental results give useful guidelines to define anisotropic etching processes scalable to large-diameter InP wafers in future industrial applications.