In recent years, the superconducting properties of materials with diamond-like structures have attracted widespread attention. The superconducting transition temperature (Tc) of most diamond-like structures is relatively low, and there has been little research on the superconductivity of ternary diamond-like materials. Here, based on first-principles calculations, we predict B2CX (X = N, P) with P3m1 space group, and reveal that they all exhibit phonon-mediated superconductivity at ambient pressure, with Tc range from 44.3 to 46.1 K, which is higher than most diamond-like superconductors. The coupling between metallic σ electrons and softened E phonon (B-C stretching modes) contributes greatly to their superconductivity. Our work provides an important theoretical basis for the experimental design and synthesis of ternary high-temperature superconductors with diamond-like structures.