Diamond is an allotrope of carbon
Diamonds are formed in a different way than in graphite.
The carbon atoms are placed under great pressure and high temperatures to form the strong covalent lattice that diamond has. It takes several billions of years for diamond to form.
This is why diamonds can be found near volcanoes, deep underground.