You're right on the money, with your assumption that withdrawing from a grant-paid class will create a financial obligation to repay.
I'm going to assume that your grant is a Pell grant, and that your Pell Grant was applied to your tuition bill.
When a student qualifies for a Pell, it's not really hers until she "earns" it. There's only one way to "earn" a Pell Grant, and that is by completing the class.
As the semester goes along, you earn more of the Grant every week - in fact, when the semester reaches the 60% point, you will have earned the entire grant.
Students who drop Pell-paid classes before the 60% point of the semester haven't completely 'earned' their grant - and so we say that some of the grant is "unearned".
How much is "unearned"? That's determined by when you stopped attending class. Your school is required to return all "unearned" funds to the Department of Education, and then they are required to look to you for a repayment of the funds that had to be paid back.
Financial aid recipients - especially those who are receiving Pell Grants must visit their financial aid office prior to submitting any withdrawal paperwork. The office will calculate what portion of your grant is unearned, and explain what you owe. That amount is called a financial aid "overpayment".
It's important to get your overpayment resolved quickly, because you are ineligible for any future aid, as long as you owe an overpayment. If you sit down with financial aid quickly, they can help you establish a repayment plan. Once that plan is in place, you regain eligibility for aid (if the amount is small, they may not be able to offer a long term payment plan).
I hope that helps - good luck!