Heat treating can be used to achieve different purposes for different materials, but it generally involves heating or cooling a material to a relatively extreme temperature with the goal of changing its properties. Most often, this is done to make a material harder or softer. Heating or cooling the material allows the internal/microscopic structure to change in a way that is preserved when the material returns to ambient temperature.
Lonsdaleite is made up of carbon atoms, just like diamonds, but the hexagonal structure makes it even harder than the sparkling gem.