When it comes to molecular bonding, a single additional atom can change the characteristics of the compound. This is why Carbon Dioxide is different from Carbon Monoxide even though they both contain only Carbon and Oxygen atoms albeit in different quantities.
In this scenario the compounds described are Hematite which has two iron atoms to three oxygen atoms and Magnetite which has three iron atoms to four oxygen atoms. The presence of the different number of the same atoms made these compounds different.