Impurity effects on chemical behavior of energetic deuterium implanted into the carbon-oxygen containing boron films were investigated as a function of impurity concentrations by means of XPS and TDS. This study was carried out for about 40% impurities-containing boron films. It was found that a major chemical state of carbon was C-B bond and that of oxygen was free oxygen for the carbon-oxygen containing boron films. Most of deuterium was trapped by the C-B bond to form a B-C-D bond. On the other hand, free oxygen formed heavy water (D2O) and released as D2O during deuterium implantation. The amount of deuterium trapped by carbon was increased as the carbon concentration increased. However, the deuterium retention for the carbon-oxygen containing boron film with less than 20% carbon was almost twice as high as that for the only about 20% carbon-containing boron films. It was also indicated that the formation of free carbon was refrained due to the existence of free oxygen which induce the increase of C-B bond in about 40% impurities-containing boron films. These results indicate that hydrogen isotopes were trapped as B-C-D bond, which released deuterium at 900 K, in lower carbon concentration as oxygen coexists with carbon in the boron films. It was concluded that impurity concentration should be kept as low as possible to prevent tritium retention in the boron film deposited on the first wall in future fusion devices.