The key to this problem is translating NFA states to variables of the
grammar. Try to create one variable for each state q. The variable generates
all strings w such that δ(q,w) is an accepting state.
Reason recursively. Start with the case that w is the empty string.
Then, make the grammar work for longer strings.