Both of these compounds are made purely of carbon. The differences come in the way in which the atoms are bonded together and the properties that this creates.In diamond, each atom is covalently bonded to four others - the maximum number of bonds allowed to any carbon atom. This generates a hard structure that is difficult to compress and would require large amounts of energy to overcome the strong covalent bonds between atoms.In graphite, the atoms are each bonded to only three others. This allows them to form hexagonal sheets which are only one atom thick. These sheets are held together by intermolecular forces which are much weaker than covalent bonds, meaning the sheets can easily slide past each other - making graphite a very soft material. Since each atom is only making three covalent bonds, this also means there is an excess electron on each carbon. These electrons delocalise into the gap between layers and are free to move, making graphite a good electrical conductor.