Generally the answer is no. However, there are some limited circumstances where it could be acceptable. You should speak with a CPA.
If you found this Answer helpful, please mark it as "Helpful" or "Best Answer". Your feedback is greatly appreciated. PLEASE NOTE: The above statements are provided for informational purposes only and do not constitute legal advice. Transmission of the information is not intended to create, and the receipt does not constitute, an attorney-client relationship between sender and receiver. You should not act or rely on any information contained on this site without first seeking the advice of an attorney.
Generally, a grandparent may assert a dependent exemption for a grandchild so long as the exemption requirements are met. They are complicated and explained, in great detail, in www.IRS.gov.
As for it "going against court order," one should ask the Court. No attorney is going to anonymously advise someone that his or her proposed course of action is not going to go "against court order." Consult an attorney.
Disclaimer: Nothing stated herein is legal advice. For legal advice, consult an attorney; I am not your attorney at this time. This response may constitute ATTORNEY ADVERTISING which has not been approved by the Supreme Courts of New Jersey or Pennsylvania or the Court of Appeals of Maryland. I am a federally-designated “debt relief agency” that provides, where appropriate, relief under the U.S. Bankruptcy Code.
As a general principle, one cannot go against a court order without suffering potential sanctions by the court, however, this only becomes an issue if your ex seeks the exemption and is entitled to the exemption under Federal Income Tax laws.
Family court judges do not determine how the Federal Internal Revenue Code is applied. To be a dependent of your ex, he needs you to sign a specific form waiving your right to the exemption for you are the parent who is the "custodial" parent of your child. The family court judge can force you to sign this form. It is not unusual as part of the Final Judgment of Divorce, and or Property Settlement, to switch who gets the dependency deduction in odd years versus even years.
If this was not set forth in either, then the Code says the custodial parent is entitled to the deduction. Based upon your facts, although your parents are NOT the custodial parents, if they provided more than 50% of your support and that of your child, it would seem appropriate for your parents to be entitled to the deduction. This is often the case when a child takes care of an elderly parent, and the parent becomes a dependent of the child and/or child and spouse.
As suggested by my colleague, speak to your tax return preparer, speak to your family law attorney and read who is entitled to the dependency deduction on the IRS website - IRS.gov.
The foregoing is not intended to be legal advice upon which you may rely as I have not been retained for this purpose.