Most times the cause of coffee grounds getting into your coffee is caused by residue built up in your coffee pot or the coffee filter getting overflowed due to an obstruction in the coffee filter basket which then causes the coffee grounds to get past the filter and then get into your coffee.
Clean the coffee pot out regularly with vinegar or coffee pot cleaner and be sure to keep your coffee filter basket clean to avoid coffee grounds in your coffee.