Formation enthalpy vs. bond enthalpy
OK, here is the difference: formation enthalpy refers to the formation of a compound from elementary compounds, while bond energy is applicable when considering the formation of a molecule from isolated atoms. The relation between the two is pretty much explained by the Hess's law: the enthalpy of a reaction does not depend on its pathway, but only on the initial and final states.

Now consider the following two pathways for your example.

Pathway 1: we burn graphite in oxygen, just like $\ce{C + O2 -&gt; CO2}$. There is some change of enthalpy associated with this reaction.

Pathway 2: we vaporize graphite to get atomic carbon (see how many C-C bonds are broken, take that into account), atomize $\ce{O2}$ to get elementary oxygen (again, some bonds are broken), and finally produce $\ce{CO2}$ (this time some bonds are formed). Now if you'll look up the energies of all bonds involved and carefully add/subtract them all together, you'll have a decent approximation of the reaction enthalpy obtained in the pathway 1.

(Normally it works the other way around, that is, we use reaction enthalpies to calculate bond energies, but... whatever.)