Can you retrieve a potion while grappling?
No.
However, drawing a light weapon orrequires a successful grapple check and retrieving a spell component both require a successful grapple checkfull round action. Even if you retrieve it using an interpolation of the spell component retrieval, you still can't use it, since drinking it is not in the "if you're grappling" actions. Escaping a grapple is the same check as drawing a light weapon. Thus, you could simply escape the grapple, then you are no longer limited to "if you're grappling". Escaping the grapple is a standard action, retrieving the potion is a move action. You'd have to wait until next round to drink it in any case.