1. What chip are you using?

2. Read the datasheet. It will have a section on each Timer/Counter available on your particular PIC. It tells you exactly what values to write to each register to set up the timer as a counter and how to read/write the current value of the counter. You will also be able to set up one of the I/O pins as a trigger for the counter and select rising/falling edge for triggering. Read up on the prescaler, you may need to set that up too.