Diamond contains pure carbon, which means that it is composed of only carbon atoms. These carbon atoms are arranged in a regular, repeating pattern called a crystal lattice. The carbon atoms in diamond are bonded to each other by strong covalent bonds, which is what gives diamond its extreme hardness.
Coal is a mixture of different carbon-containing compounds. It contains carbon, hydrogen, oxygen, nitrogen, and sulfur atoms. The carbon atoms in coal are arranged in a disordered, irregular way, which is why coal does not have a crystal structure. The carbon atoms in coal are bonded to each other by weaker van der Waals forces, which is what makes coal softer than diamond.