When performing a course backup, if the user de-selects an activity in the inclusion list, then no grade categories are included in the backup, however the grade items that reference those grade categories are present.
Refer to backup/backuplib.php, line 1529. A check for type 'mod' grade items is done to see if the associated mod has been de-selected from the backup. If so, then ALL grade categories are excluded, even though there may be some manual grade items.
When attempting to restore such a backup in Moodle 2.x, this will cause the Grades interface to puke (recursion until memory exhausted), because a manual grade item is anticipated to have a valid category id, but it won't have one.
A corresponding bug ticket will be entered for the 2.x issue.