Is there any tool to find lines of codes responsible to generate front-end HTML elements?

Any decent IDE for PHP comes with search capabilities. It is usually rather easy to find code responsible if it uses specific ids and/or class names.

Personally I use NetBeans for PHP, also see Software for WordPress Theme and Plugin Development? question. A tons of good tools mentioned there.