How do they pick actually ? I guess its not a manual process. So inserting any filter in the code ?
Most miners "choose" by setting three parameters in bitcoind (or a modified version of bitcoind).
1) The block size
2) The amount of space devoted to high priority txs with no fees.
3) The min fee for the rest of the block space.
Bitcoind sorts and ranks transactions and then as many tx as will fit that criteria are used. For the "free" portion of the block tx are ranked by priority. For the "paying" portion of the block they are ranked by fee/KB. For default implementation for the transactions to be added to the memory pool (and thus be eligible for inclusion) they must be "standard" (pass the IsStandard checks).
For example setting 500KB, 50KB, and 0.1 mBTC the software would analyze the memory pool (list of tx waiting to be confirmed) and add free txs in order by priority until the next tx would make the total >50KB. It would then add paying txs ranked by fee/KB until the next transaction would make the block larger than 500KB.