How to highlight a polygon or a vertex under the pointer in Python?
Look at these templates:
1) Operator Modal View3d Raycast: With this you will find the polygon of a mesh under the mouse cursor.
2) Operator Modal Draw: This contains an example of using BGL for drawing in 3d view. With this you will be able to draw the edges of the polygon you find from raycast.