Carol Marshall has a grandson named Gary who is claimed as a dependent on his parents' joint return. Carol paid Gary's tuition directly to the university. For purposes of claiming an education credit, Gary is treated as receiving the money as a gift and paying for the qualified tuition and related expenses.
Since Gary's parents are claiming him as an exemption, they may be able to use the expenses to claim an education credit. Alternatively, if Gary claims himself on his return (and his parents do not), he might be able to claim the expenses as if he paid them himself.