To search new hard or superhard materials in transition-metal light-element compounds is a current research focus. Most of the past researches focused on binary phases such as transition metal borides, carbides and nitrides, while the researches on ternary phases were relatively rare. The single crystals Nb
3B
3C and Nb
4B
3C
2 were synthesized recently by using Al-Cu alloys as auxiliary metals and their structures were determined by Hillebrechtand Gebhardt. In the present paper, 29
TM3B
3C and 29
TM4B
3C
2 configurations are constructed by
TM atoms (
TM = Sc to Zn, Y to Cd, Hf to Hg) replacing Nb atoms in the known Nb
3B
3C and Nb
4B
3C
2 configuration. By calculating the formation energy from first-principles density functional theories, only 13
TM3B
3C and 11
TM4B
3C
2 phases are stable compared with the three elemental substances of
TM, boron and carbon. However compared with the most competing phases, only Ta
3B
3C, Nb
3B
3C and Nb
4B
3C
2 phases are stable thermodynamically. The metastable Ta
4B
3C
2 phase at 0 K becomes stable when temperature is higher than 250 K. Thus two new phases of Ta
3B
3C and Ta
4B
3C
2 are uncovered to be stable thermodynamically. Global structure searches conducted by the popular USPEX and CALYPSO softwares prove the Ta
3B
3C and Ta
4B
3C
2 phases to be the most favorable energetically. By calculating the phonon dispersion curves of the Ta
3B
3C and Ta
4B
3C
2 phase, no imaginary phonon frequencies are observed in the whole Brillouin zone, which demonstrates the dynamical stability of the Ta
3B
3C and Ta
4B
3C
2 phase. The calculated elastic constant of the Ta
3B
3C and Ta
4B
3C
2 phases satisfy the criteria of mechanical stability, showing that the Ta
3B
3C and Ta
4B
3C
2 phase are stable mechanically. The calculations of band structure and density of state show that the Ta
3B
3C and Ta
4B
3C
2 phases are both conducting, which mainly arises from the d electrons of Ta atoms. The calculated bulk modulus and shear modulus of the Ta
3B
3C and Ta
4B
3C
2 phases show their brittle nature. The hardness of Ta
3B
3C and Ta
4B
3C
2 phase are nearly the same and calculated to be about 26 GPa by Chen’s and Tian’s models, which illuminates that the two phases are hard but not superhard.