If you construct the grid initially (first time) you can use a php script to do that. i.e
colModel:[{name:myname,… editoption:{here is the php script}…}]
This is only the first time. If you want this to be a dynamically on every request you can use userdata option in xml or json data from the server. See documentation. This is a array which can be used again with a setGridParam after every request is done. If you need help please let me known