You can claim PIP [or DLA, not that they are taking new claims anymore] for mental health problems just the same as physical health conditions. It is about how the illness affects your daily living tasks. If you are unable to work and qualify for ESA I would seriously look at the criteria for PIP because you may well qualify for some benefit here and this is not income related.
I think [do not quote me] the problem you may be encountering is that if you were to recieve this course grant then DWP would have to deduct whatever the grant pays you, from your ESA and essentually you would then have no money to live off. Even if it is paid directly to the uni, it would still be in your name, and to your benefit; thus DWP states it is an income.
If the above were to be true, the DWP could have been trying to prevent you from making the mistake of having your benefit cut and no money to live on. This has happened to someone I know who got a grant at college then married someone who was on benefits, they then had to declare and had the couple rate slashed to an intolerable amount.