How do I add a class to HTML bookmarks generated by core?
Those anchors are added in comment_view(). To override them you'll need to implement hook_comment_view_alter() and reproduce a bit of the logic from the original view function:

function MYMODULE_comment_view_alter(&amp;$build) {
  $comment = $build['#comment'];
  $node = $build['#node'];

  if (empty($comment-&gt;in_preview)) {
    $prefix = '';
    $is_threaded = isset($comment-&gt;divs) &amp;&amp; variable_get('comment_default_mode_' . $node-&gt;type, COMMENT_MODE_THREADED) == COMMENT_MODE_THREADED;

    // Add 'new' anchor if needed.
    if (!empty($comment-&gt;first_new)) {
      $prefix .= "&lt;a id=\"new\" class=\"bookmark\"&gt;&lt;/a&gt;\n";
    }

    // Add indentation div or close open divs as needed.
    if ($is_threaded) {
      $prefix .= $comment-&gt;divs &lt;= 0 ? str_repeat('&lt;/div&gt;', abs($comment-&gt;divs)) : "\n" . '&lt;div class="indented"&gt;';
    }

    // Add anchor for each comment.
    $prefix .= "&lt;a id=\"comment-$comment-&gt;cid\" class=\"bookmark\"&gt;&lt;/a&gt;\n";
    $build['#prefix'] = $prefix;
  }
}