Hello Jenny,
The problem isn't with the grout, it's your flooring. Before installing any tiles you need a solid foundation.
It would be a waste of time and money to replace the grout as it will only crack again over time.
Your best option and sadly most expensive would be to remove the tiles...