How do I identify the right .php page
Sometimes you can get clue from .tpl file form view source page. The other option is to find the page callback of the the url. Each CiviCRM url defined in menu xml file has a callback. The page callback gives the clue which file is being invoked. For eg civicrm/activity/view

If you a grep 'civicrm/activity/view' on CRM/ and open the xml file you will see something like this

&lt;item&gt;
     &lt;path&gt;civicrm/activity/view&lt;/path&gt;
     &lt;title&gt;View Activity&lt;/title&gt;
     &lt;page_callback&gt;CRM_Activity_Form_ActivityView&lt;/page_callback&gt;
     &lt;access_arguments&gt;access CiviCRM&lt;/access_arguments&gt;
  &lt;/item&gt;


Which means the file CRM/Activity/Form/ActivityView.php is called in this situation.  

HTH

Pradeep