Diamond is a giant covalent structure of Carbon atoms in which every atom makes 4 covalent bonds, each with another Carbon atom, forming a regular tetrahedral structure. This results in a very hard substance with an incredibly high boiling point as it takes a lot of energy to break the strong covalent bonds between Carbon atoms. There are no free ions or electrons in this structure therefore it doesn't conduct electricity. Magnesium is made up of positive Magnesium cations - Mg2+ arranged in a lattice. These are arranged in rows surrounded by a sea of delocalised electrons. These layers of cations can slide over each other causing magnesium to malleable. The free electrons can move and thus magnesium can conduct electricity. The strong electrostatic attraction between the cations and the negatively charged sea of electrons is very strong and takes a lot of energy to break therefore Magnesium also has a high boiling point. The boiling point of Diamond is still much higher because covalent bonds take a lot more energy to break than metallic bonds.