This might be a use for project tags, if you set up each ringfenced grant as a separate project you could tag the expenses “purchase” to the relevant project to record the source of the funds that were spent. For the incoming grant funds you’d record it using a dummy bank account as described in the thread you linked to, but you could also set an “adjustment” on the relevant project tag to link the funds to the project.