can someone please tell me what is the purpose of Magento's customer_grid_flat table? What is used for?
That table contains the data to be shown in the customer grid. Is the table used for search or sort (with the grid controls).
If you create a new attribute and you want to use it in that grid too you should add the attribute to that table too.