What is giving you trouble, the code for the grid or its visualization?
The code for a 64 quant sized grid can for instance look as follows:
var grid_id_x = floor(ent_marker.x/64); // You are looking for the grid position of some entity "ent_marker"
var grid_x = grid_id_x*64;
If your grid does not start at the origin you can simply add some kind of offset:
var grid_id_x = floor((ent_marker.x-offset_x)/64);
var grid_x = grid_id_x*64+offset_x;