Start by adding a Child Theme if you haven't done so already.
Read the Template Hierarchy link like slaFFik suggested.
Add a directory 'buddypress' to your child theme.
Copy the core template files you want to edit from wp-content/plugins/buddypress/bp-templates/bp-legacy/buddypress/(XXX/YYY/)zzz.php into themes/yourchildtheme/buddypress/(XXX/YYY/)zzz.php
If you edit the core files directly your changes could be lost when you update BP.