A grant given for a set purpose: record it with Money received (or an invoice, if the funder wants one) to Grants, in a restricted fund for that purpose. Set a default fund on the Grants account so new lines start there.
A grant for a later period, or with conditions you have not met yet: record it to "Grants received in advance". When you are entitled to it, move it to income with a journal.
A donation: to Donations, in the general fund, unless the giver said what it is for, in which case use a restricted fund. One receipt can be split across funds with more lines.
A grant you give out: a cost, such as "Grants paid", recorded when you commit to it.
Funds: Accountant, Funds lists each fund and its balance; Move money between funds sets opening balances or releases a fund once its purpose is met. The statement of funds report shows each fund's money in and out for the year.