Go to app/code/core/Mage/Adminhtml/controllers/Sales/OrderController.php
addCommentAction is responsible for save comment.
How to save?
Go to app/code/core/Mage/Sales/Model/Order.php, check following code block
/*
* Add a comment to order
* Different or default status may be specified
*
* @param string $comment
* @param string $status
* @return Mage_Sales_Model_Order_Status_History
*/
public function addStatusHistoryComment($comment, $status = false)
{
if (false === $status) {
$status = $this->getStatus();
} elseif (true === $status) {
$status = $this->getConfig()->getStateDefaultStatus($this->getState());
} else {
$this->setStatus($status);
}
$history = Mage::getModel('sales/order_status_history')
->setStatus($status)
->setComment($comment)
->setEntityName($this->_historyEntityName);
$this->addStatusHistory($history);
return $history;
}