The standard enthalpy of formation (\(\Delta H_{\rm f}^\circ \)) is defined as the enthalpy change for creating one mole of a compound from elements in their standard states. The standard states are the form you would find an element in at 1 bar pressure and 25 °C.
For example, the standard enthalpy of formation for CH4 would be denoted as \(\Delta H_{\rm f}^\circ ({\rm CH_4(g)})\) and would be the enthalpy change for the following reaction
\[\rm C(s,graphite) + 2H_2 (g) \rightarrow CH_4 (g)\]
Carbon is denoted as being graphite as the energy would be different for the absurd reaction run with the diamond form of carbon. Since hydrogen is a molecular gas under standard conditions, this is the form required in the standard reaction.
It is important to note that the enthalpy of formation for any element in its standard form will be exactly zero since for such a reaction the reactants (initial state) and the products (the final state) are identical and thus cannot have any change in enthalpy. For example the "reaction" for the formation of molecular oxygen gas is
\[{\rm O_2 (g) \rightarrow O_2 (g)} \Delta H = 0\]
The enthalpy of formation of a non-standard form is non-zero. Also, the enthalpy of formation will depend on the state of the compound that is being formed. For example, the enthalpy of formation of gaseous water will be higher than the enthalpy of formation of liquid water (They will be different by the enthalpy of vaporization of water, \(\Delta H_{\rm vap} \)).
Enthalpies (or heats) of formation are extremely useful in calculating reaction enthalpies. That is because any reaction can be visualized as taking place via a path in which first all the reactant compounds are converted to elements and then all the elements are converted in the product compounds. The first step in this process will be the negative of the sums of the enthalpies of formation of the reactants. Negative since it is the reverse of the formation reaction (compounds to elements). The second step is the sum of the enthalpies of formation of the products.
\[\Delta H_{\rm r}^\circ = \Sigma\,n\, \Delta H_{\rm f}^\circ {\rm (prod)} - \Sigma \,n \,\Delta H_{\rm f}^\circ {\rm (react)} \]
For more information on this important concept, please download and read Dr. McCord's Help Sheet on Standard Reactions of Formation.