Sounds like you're looking for the Edit Limit module.
Edit Limits adds certain limits to editing nodes and comments. This can set the number of times a node can be edit. This can also set a time frame for nodes to be edited, as well as a different time frame that comments can be edited.
Comments can be set to only be limited within a given time frame. Site administrators can set the number of seconds after a comment is initially posted before it can no longer be edited. Time remaining will be displayed to the user.
Unfortunately, the module is not well documented, but here is an example of how you may use to provide a three minute grace period for editing own comments:
First navigate to Administration » People » Permissions. Under Comment, enable the permission "Edit own comments" for whatever role you want to have this permission (typically "Authenticated user"). Scroll down to the bottom of the screen and press "Save permissions".
Then, navigate to Administration » Configuration » Content authoring » Edit Limit and configure the module to enable comment limits, to three minutes, and select the content types you want this to apply to. Press "Save configuration" when done.
This is how it looks like when working:
At the time of writing, it does not work for RTL languages. See this issue: Edit Limit doesn't show edit link for RTL languages for the current state of this bug.