There is not going to be an easy way. Probably the best way would be to build an additional web part using one of the core parts like comments as the template. In this part you would access the ID fro, the project task your referring to on the page (would have to do this somehow programmatically) and add that as an additional field on your comments page type.
An out of the box 'Hack' would be to add a 'new' link next to Each task that passes the ID to either another page or the same and show the comment web part based off the existence of the Querystring. You could then save that value as part of your comment.
Just a couple of thoughts. Others might have some more.